home *** CD-ROM | disk | FTP | other *** search
- ________________________ Subj: Playing Sound on PC ________________________
-
- Fm: Mark Betz/GD SL 76605,2346 # 181875
- To: Intergalactic, Dev., Inc 76356,2172 (X) Date: 27-Jun-92 13:08:37
-
- A couple of choices, Ezra: You can roll your own. This will involve creating
- a low-level driver (probably driven off the timer interrupt). Or, you can
- purchase a library, such as John Ratcliff's DIGPAK, which supports a variety
- of sound devices. Adlib .ROL, and CMS .CMF files are essentially MIDI files
- with restricted MIDI event/message recognition. The files are parsed, and the
- driver will turn notes on and off at the proper times. I've done low-level
- programming to the FM chip, but haven't had occasion to parse MIDI files yet.
- I imagine it's not trivial programming, as the timing must be fairly precise.
- --Mark
- ...........................................................................
-
- Fm: Mark Betz/GD SL 76605,2346 # 181904
- To: Sarwan Narine 76675,164 Date: 27-Jun-92 14:52:53
-
- Hi, Sarwan. There are several routes you can go. The DSP chip on the
- Soundblaster (and TB) can be driven via DMA, freeing the CPU for other
- business. Or it can be "pumped" using the timer to send data to it at the
- correct speed. Whichever route you take will be fairly complex and require
- low-level programming to the sound card hardware. A third alternative is to
- use the supplied drivers, which can be loaded and accessed by your program,
- and a fourth is to purchase a sound devide library like DIGPAK. For
- alternatives 1, 2, and 3, get yourself a copy of the Sound Blaster
- Developer's Kit from CMS. It's not great, but you can use it to get the job
- done, and there is good information on the low-level interfaces to the
- hardware.
- Creative Labs, Inc.
- 2050 Duane Ave.
- Santa Clara, CA 95054
-
- Sorry! I don't have the phone number at hand.
-
- --Mark
- ...........................................................................
-
- Fm: Rasch H Young 70511,2043 # 182020
- To: Sarwan Narine 76675,164 Date: 27-Jun-92 22:24:51
-
- Sarwan,
-
- I have both the Sound blaster SDK and DIgPak. I believe DIGPAK pro is a
- better product at a lower price $69.95. The Audio Solution 1-314-567-0267.
-
- Rasch
-
- ________________________ Subj: Sound card detection ________________________
-
- Fm: Sarwan Narine 76675,164 # 185506
- To: All Date: 08-Jul-92 02:47:07
-
- How do you detect the presence of a sound card in a PC system?
- ...........................................................................
-
- Fm: Mark Betz/GD SL 76605,2346 # 187160
- To: Sarwan Narine 76675,164 (X) Date: 12-Jul-92 19:54:16
-
- Hi, Sarwan. Here is a function (and support functions) for detecting the
- presence of the FM music chip. If DetectFM() returns true then the chip is
- present in the system. This tells you that you have either an SB, Adlib, or
- one of the SB clones. You can further distinguish between the SB and Adlib,
- but more on that later. The first function we need is a function to send data
- to the FM chip registers. Here's one in assembler...
-
- _SetReg proc far
- push bp
- mov bp, sp
- push ax
- push cx
- push dx
- xor ax, ax
- mov dx, 0388h ; FM Address Register Port
- mov al, byte ptr [bp + 6] ; get the register into al
- out dx, al ; write it to the Address Reg.
- mov cx, 7 ; need to wait 3.3 microsecs here...
-
- wait1: ; which we'll do by reading the
- in al, dx ; status reg 7 times
- loop wait1
- mov al, byte ptr [bp + 8] ; get the data byte into al
- inc dx ; point dx to the Data Register Port
- out dx, al ; write the data
- mov cx, 35 ; need to wait 23 microsecs here...
- wait2: ; read the port 35 times
- in al, dx
- loop wait2
- pop dx
- pop cx
- pop ax
- pop bp
- retf
- _SetReg endp
-
- The techniques for this come right out of the Sblaster Developer's Kit, which
- I recommend. It's not the job I wish it was, but it's all that is available
- as far as I know. I haven't seen any books on the topic. Anyway, the SBDK is
- adequate if you're willing to go mining yourself for the stuff it doesn't
- give you. Call CMS at 408-986-1461 if you're interested. Now that we have the
- function to set the registers we need the the function that detects the card.
- This writes to some registers, which are referred to in the calls to
- SetReg(). I won't explain what they do, as this is a topic for a long
- magazine article, or chapter in a book.
-
- // DetectFM() returns true if the FM chip is detected in the system, or
- // false if it is not.
-
- bool DetectFM() {
- byte stat1;
- byte stat2;
- byte result = 0;
-
- SetReg( 0x1, 0 ); // initialize test register
- SetReg( 0x4, 0x60 ); // reset both timers
- SetReg( 0x4, 0x80 ); // enable timer interrupts
- stat1 = inportb( 0x388 ); // read the status port
- SetReg( 0x2, 0xff ); // write ff to the timer 1 count
- SetReg( 0x4, 0x21 ); // start timer 1
- Wait( 90 ); // wait 90 microseconds
- stat2 = inportb( 0x388 ); // read the status port
- SetReg( 0x4, 0x60 ); // reset both timers
- SetReg( 0x4, 0x80 ); // enable timer interrupts
- stat1 &= 0xe0; // stat1 should be zero after
- if ( !stat1 ) { // ANDing it with 0xe0
- stat2 &= 0xe0; // stat2 should be 0xc0 after
- if ( stat2 == 0xc0 ) { // ANDing it with 0xe0
- result++; // if so, return true
- }
- }
- return( result );
- }
-
- Oh, and I see we have one other support function required. Wait() simply
- waits for the specified number of microseconds, approximately. You can
- substitute your own function if you like, but here is the technique used in
- the SBDK. I would probably implement it as a more accurate timer-based
- function, instead of reading the bus the way they do, but I haven't had the
- time to re-do it.
-
- // Wait() approximates a wait in microseconds by reading the bus. Called
- // only by the DetectFM() function.
-
- void Wait( int howLong )
- {
- byte dummy;
- int reads = howLong / 10;
- reads *= 16;
- do
- {
- dummy = inportb( 0x388 );
- reads--;
- } while ( reads );
- return;
- }
-
- One last thing. I mentioned that you can tell whether it's a Sound Blaster FM
- chip you're detecting. This is because the SB maps the chip to ports 0x2x8
- and 0x2x9 (where x is the base port address of the SB). The Adlib standard is
- to map the chip to 0x388 and 0x389. To maintain compatibility the SB decodes
- the chip here as well. So if you can find the chip at both locations it's a
- Sound Blaster. If not it's an Adlib.
-
- ________________________ Subj: Sound card I/O ports ________________________
-
- Fm: Sarwan Narine 76675,164 # 187955
- To: Mark Betz/GD SL 76605,2346 (X) Date: 15-Jul-92 02:46:26
-
- Mark, thank you for that informative and complete example of how to detect a
- sound card.
-
- On my ThunderBoard sound card I can set the I/O port addresses to 210h, 220h,
- 230h, 240h, 250h, or 260h. How do you find out where the I/O ports are? The
- documentation I have says that only ports 2n6, 2n8, 2n9, 2nA, 2nC, and 2nE
- are used, where n is 1,2,3,4,5,or 6. What are these ports? A brief
- description of each port would be appreciated. Thank you.
-
- --Sarwan-
- ...........................................................................
-
- Fm: Mark Betz/GD SL 76605,2346 # 188069
- To: Sarwan Narine 76675,164 Date: 15-Jul-92 15:12:08
-
- Hi, Sarwan. According to my reference the SB uses the addresses from 2n0H to
- 2nFH where n is in the range 1 to 6 inclusive. Here is a map of the ports:
-
- PORT WHAT IS IT WHAT CAN I DO TO IT
- ------------------------------------------------------------------
- 200H-207H ANALOG JOYSTICK READ/WRITE
- 2n0H C/MS MUSIC VOICE 1-6 DATA PORT WRITE ONLY
- 2n1H C/MS MUSIC VOICE 1-6 REGISTER PORT WRITE ONLY
- 2n2H C/MS MUSIC VOICE 7-12 DATA PORT WRITE ONLY
- 2n3H C/MS MUSIC VOICE 7-12 REGISTER PORT WRITE ONLY
- 2n6H DSP RESET WRITE ONLY
- 2n8H FM MUSIC STATUS PORT READ
- 2n8H FM MUSIC REGISTER PORT WRITE
- 2n9H FM MUSIC DATA PORT WRITE ONLY
- 2nAH DSP READ DATA PORT READ ONLY
- 2nCH DSP WRITE DATA OR COMMAND WRITE
- 2nCH DSP WRITE BUFFER STATUS (BIT 7) READ
- 2nEH DSP DATA AVAILABLE STATUS (BIT 7) READ ONLY
-
- The C/MS music voice ports are available only on SB cards with these chips
- installed. The FM music ports can also be accessed at ports 388H and 389H
- (for Adlib compatibility).
-
- --Mark
- ...........................................................................
-
- Fm: Mark Betz/GD SL 76605,2346 # 189758
- To: Sarwan Narine 76675,164 Date: 20-Jul-92 16:21:03
-
- >> ...how do you find the value of n
-
- Well, there are a couple of options. You can ask the user, which is the route
- most apps take. You can rely on Creative's SBLASTER environment variable
- (NOT!). Or you can perform the test I outlined for each possible port.
-
- --Mark
-
- _________________________ Subj: Playing .VOC files _________________________
-
- Fm: Sarwan Narine 76675,164 # 191206
- To: All Date: 24-Jul-92 04:12:35
-
- How do you output an 8-bit sample of a .VOC file through the SoundBlaster or
- AdLib sound card? Also, is there any on-line information on using a DMA
- channel or timer to playback sound? I'm looking for assembly source code.
- Thank you.
-
- --Sarwan-
- ...........................................................................
-
- Fm: Mark Betz/GD SL 76605,2346 # 191420
- To: Sarwan Narine 76675,164 Date: 24-Jul-92 20:02:33
-
- Hello again, Sarwan. If you have the manual for the Sound Blaster you will
- find a simple reference to the functions in the CT-VOICE.DRV driver supplied
- on disk with the card. This driver is the simplest way to pump data to the
- dsp chip, since it provides you with some high level control constructs.
- Alternatively you can write directly to the chip. The DSP chip is actually
- very simple, being sort of like a pipe with one end attached to memory, and
- the other to the speaker system. All you really have to do is pour data into
- it at the proper rate. You can do this either by pumping it through with the
- timer interrupt, or using the DMA channel 1. I strongly suggest contacting
- Creative Labs and buying the SB developer's kit.
-
- If you simply want to get sound support, then I suggest the DIGPAK library.
- Leave mail or a message here for John Ratcliff 70253,3237. The have a lib for
- sale at a very good price which supports midi and digitized sound on just
- about every device you can imagine, if half of what I've heard is true.
-
- --Mark
- ...........................................................................
-
- Fm: James Mayes 71151,3037 # 203245
- To: Mark Betz/GD SL 76605,2346 (X) Date: 21-Aug-92 18:04:08
-
- I also have another question. I recall your recently discussing with
- someone else your experience programming the Soundblaster by loading the
- driver into memory and then making calls to the driver with the correct
- registers initialized properly. I have always used the SB Development Kit
- by Creative, but I am curious about the direct method and I was wondering
- about a few things. (BTW, I am strictly talking about digitized voice and
- the CT-VOICE driver)
-
- 1. The SBK says you need to load the driver at offset 0 of some
- segment, load the registers and make a far CALL to that seg,off. What
- would be the syntax for making this call from C given a far pointer to
- the buffer containing the driver?
-
- 2. The CT-VOICE driver doesn't include any functions for detecting the
- SB card or scanning for the correct interrupt number. Are you aware of
- any good sources for this info?
-
- 3. Do you know if there would be a problem with distributing the
- CT-VOICE driver file with a game that used this approach? (I don't
- think there should be, but those kind of questions always worry me.)
- ...........................................................................
-
- Fm: Mark Betz/GD SL 76605,2346 # 203304
- To: James Mayes 71151,3037 (X) Date: 21-Aug-92 19:47:00
-
- Hi, James. I'm not sure what you mean by "the direct method". Is there some
- other way to access CT-VOICE.DRV explained in the SDK? Basically you have to
- get the driver into memory first. That requires allocating memory for it, and
- reading it in. The twist is that you have to allocate an extra paragraph, or
- 16 bytes, so that you can force the offset to 0. the new keyword and alloc()
- functions usually return an offset of 4, and in any case you can't guarantee
- that the offset will be 0. Allocate an extra paragraph, and do a little
- segment/offset arithmetic to normalize the pointer (make sure to keep a copy
- of the original for use with free() or delete).
-
- Once you get the driver read into memory you can set the IRQ and port address
- directly. The offsets of these values are listed in the SDK, but anyway, they
- are right near the beginning of the CT-VOICE driver file; maybe offset 40h or
- thereabouts. As for finding out which values to use, you either have to ask
- the user, or test all possible combinations.
-
- From that point on it's a simple matter of casting the driver buffer pointer
- to a pointer to function, and then making calls to it.
-
- void* buf; // pointer to buffer void (*drvr)();
- // function pointer buf = new byte[sizeof_driver]; // alloc driver
- memory drvr = (void(*)()) buf; // not sure about this cast!
- ...........................................................................
-
- Fm: Sarwan Narine 76675,164 # 203407
- To: All Date: 22-Aug-92 02:06:32
-
- Well, I've posted this question before, with unsucessful results. So, I'll
- post it again -- because I like to aggravate people <g>.
-
- OK, here it is: How do you output an 8-bit sample to the SoundBlaster card?
- Assume the SB is installed at 220h. Thanks.
- ...........................................................................
-
- Fm: Mark Betz/GD SL 76605,2346 # 203510
- To: Sarwan Narine 76675,164 (X) Date: 22-Aug-92 13:39:16
-
- Sarwan, if you're talking about driving the output from your application,
- then you are into several complex areas of hardware programming, including
- the interrupt controller, dma controller, and the dsp chip on the SB. I'll
- give you skeletal procedures for doing it with the driver, but you'll have to
- dig in your references for the details.
-
- Using the driver: 1. Allocate ram for the driver on the heap. The driver
- needs to be loaded at offset 0 of a segment, so grab
- a paragraph more than you need, and do pointer math
- to force the offset to 0 and the seg to the largest
- possible value.
- 2. Read the driver (CT-VOICE.DRV) into memory.
- 3. Set a function pointer on the first byte of the driver
-
- NOTE: to call a driver function set BX = the function no.,
- and set any other registers needed, then call the driver.
- 4. Set the base I/O address. BX = 1, AX = base I/O addr.
- 5. Set the dma interrupt. BX = 2, AX = dma interrupt no.
- 6. Initialize the driver. BX = 3. Returns error code, AX.
- AX = 0: driver init successful
- AX = 1: bad driver version
- AX = 2: I/O read/write failure
- AX = 3: DMA interrupt failure
- 7. Load the voice data into memory (see block structure)
- 8. Turn the speaker on. BX = 4, AL != 0.
- 9. Start voice output. BX = 6, ES:DI = voice data, returns
- error code, AX.
- AX = 0: output successful
- AX != 0: failure
- 10. Turn speaker off. BX = 4, AL = 0.
- 11. Terminate driver. BX = 9.
-
- Note that the voice data you output must be in CMS .VOC format. This format
- uses a block structure, with each block of data preceeded by a header which
- identifies it to the driver. The only block-type you're concerned with at
- this point is the Voice Data Block. It looks like this:
-
- byte 0 : type field = 01
- 1-3: three bytes data block length (actual length - 2)
- 4 : time constant = 256- (1000000 / sampling rate)
- 5 : compress. (0: raw, 1: 4-bit, 2: 2.6-bit, 3: 2-bit)
-
- Make sure one of these blocks is at the front of your voice data and
- initialized correctly. Once you start the voice output you'll get control of
- the processor back, and your program can continue.
- ...........................................................................
-
- Fm: James Mayes 71151,3037 # 203802
- To: Mark Betz/GD SL 76605,2346 (X) Date: 23-Aug-92 10:45:17
-
-
- Thanks a lot, Mark. By "direct method" I simply meant writing my own code
- to access the driver rather than calling the ctvm_XXXX routines supplied
- with the SDK. The longer I program, the worse my English becomes <g>. The
- info you gave me was exactly what I was looking for. I think I will give it
- all a try very soon. Thanks for your help!!
- ...........................................................................
-
- Fm: Sarwan Narine 76675,164 # 207584
- To: Mark Betz 76605,2346 (X) Date: 02-Sep-92 02:51:10
-
- Hi Mark. I haven't had much success with playing back a .VOC file thru the
- SoundBlaster. Here's what I've got (assume SB installed at 220h):
-
- ; reset DSP
-
- OUT 226h, 1
- OUT 226h, 0
-
- ; turn on the speaker
-
- OUT 22Ch, 0D1h
-
- ; playback loop
-
- PLAYBACK_LOOP: OUT 22Ch, 10h
- OUT 22Ch, SAMPLE
- DELAY
- LOOP PLAYBACK_LOOP
-
- ; turn off the speaker
-
- OUT 22Ch, 0D3h
-
- Hey kids, don't try this at home. The above is "pseudo-code", don't try it
- on your assembler <g>.
-
- OK, Mark, the above _occasionally_ outputs something resembling the .VOC file
- contents, although it sounds like it's played-back in slow-motion. Most of
- the times I get no output. Any suggestions?
- ...........................................................................
-
- Fm: Mark Betz/GD SL 76605,2346 # 207964
- To: Sarwan Narine 76675,164 (X) Date: 02-Sep-92 23:34:56
-
- Hi, Sarwan. The procedure outlined in the manual says that you must wait 3
- microseconds between the two steps of the DSP reset process. It could be that
- this is mandatory, and it could be intermittent because certain variances
- caused by a cache hit/non-hit or something are causing you to get a >= 3
- microsecond delay on some calls, and not on others. I'd specifically place
- the delay in the function. As for slow playback, that is almost certainly
- related to the speed with which you're sending the data to the DSP.
- ...........................................................................
-
- Fm: Hans Peter Rushworth 100031,473 # 214082
- To: Mark Betz/GD SL 76605,2346 (X) Date: 17-Sep-92 10:08:04
-
- >> The volume can be controlled by altering the sampled data in certain
- mathmatically precise ways that I do not know <g>.
-
- It is much simpler than you think!
-
- If the samples are simple signed amplitudes, then just multiply each 8-bit
- sample by a constant from 0 to 256, and use the top 8 bits of the result. If
- they are unsigned, convert to signed by subtracting 128 first, and adding 128
- afterwards. (you must use a signed multiply or equivalent shift operation).
- The output volume is not linearly related to the multiplier. A range of 0 1 2
- 4 8 16 32 ... (ie use shifts!) will give a more or less linear progressive
- increase in volume (ie half the amplitude is NOT half as loud). With low
- multipliers the quantisation error (hence noise) will be high, unfortunately.
- Only 8-bits are a bit limiting I'm afraid (pun intended), so for a finer
- variation in volume you may need find intermediate values for the multiplier.
- For example, the multiplier between 128 and 256 is 181, (not 192) which is
- found by taking 2^7.5 (2^7 is 128 and 2^8 is 256, so 2^7.5 is half way in
- between).
-
- You shouldn't simply add values as you suggest, since this will introduce
- high levels harmonic distortion, not what you want I suspect.
-
- _______________________ Subj: Sound Blaster Effects _______________________
-
- Fm: Jesse 76646,3302 # 267987
- To: all Date: 26-Dec-92 15:32:45
-
- Here's a thought, though it's either easy to do and has already been done, or
- it can't be done and hasn't [g]
-
- Instead of worrying about .vocs for small sound effects like gunfire,
- explosions, engine noise, etc, couldn't we just create an instrument for each
- sound and dynamically "play" them as the game goes on? I've only peeked at
- the FM-Organ thing that came with the SB, but I seem to recall it letting
- several instruments play at once.
- ...........................................................................
-
- Fm: John W. Ratcliff 70253,3237 # 268036
- To: Jesse 76646,3302 Date: 26-Dec-92 17:43:38
-
- Jesse,
-
- >>just create an instrument for each sound and dynamically "play" them as the
- game goes on?
-
- Yes it can be done. That is in fact how all sound effects are made in Ultima
- Underworld and a number of other games. However, it is very difficult to
- do, has no analgy on non-FM synth devices, and digital sound effects are
- easier and sound better. Plus I'm selling DigPak and people should definatly
- be doing digital effects from my point of view. You can do all of you
- music/FX that way if you use the Audio Interface Library from Miles Design
- Inc. However, AIL has a rather overwhelming API and is out of the price
- range of the small developer.
-
- John.
- ...........................................................................
-
- Fm: Mark Betz/Ass't SysOp 76605,2346 # 268883
- To: Jesse 76646,3302 (X) Date: 28-Dec-92 11:26:54
-
- Hi, Jesse. I don't know how many people use digitized sound for engine
- noises. The engine is one area where a synth chip can do a fine job, so my
- approach has been to create the engine noises on the synth, leaving the
- sampled sound to be used for specific effects.
-
- _____________________ Subj: Sound Blaster Programming _____________________
-
- Fm: Everett Kaser (Sherlock) 70673,1547 # 310695
- To: Vu Truong (Siliconis) 70242,3015 (X) Date: 08-Mar-93 22:10:28
-
- There's a file available from an FTP site on internet (and may be somewhere
- here on CIS) written by Jeffrey S. Lee for the Soundblaster Freedom Project.
- It's file name is usually SFP.ZIP. It contains lots of good reference
- information regarding the Soundblaster (and Adlib) registers. I have a
- couple of other files that I've snarfed off of internet that contain file
- formats for SBI files and CMF files. If they're not already available in one
- of the libraries, and someone would point out the appropriate place for them,
- I'd be glad to upload them (on Tuesday, for a hamburger today <G>).
-
- Everett
- ...........................................................................
-
- Fm: Dan Corritore 70243,1110 # 310714
- To: Vu Truong (Siliconis) 70242,3015 (X) Date: 08-Mar-93 22:36:29
-
- I have the format here, but I'd rather not type the long descriptions that
- are on it. If you want more description, buy 'The Sound Blaster Book'--very
- useful, especially in the file-formats category.
- Bytes Description
- 0-3 File ID-- 'SBI' followed by 0x1a
- 4-35 Instrument Name--name of instrument (ASCIIZ form)
- 36 Modulator sound properties
- 37 Carrier sound properties
- 38 Modulator volume
- 39 Carrier volume
- 40 Modulator attack/delay
- 41 Carrier attack/delay
- 42 Modulator sustain/release
- 43 Carrier sustain/release
- 44 Modulator waveform
- 45 Carrier waveform
- 46 Synthesis mode and phase shifting
- 47-51 Future use
- Sorry if the above does not appear in columns.. my software doesn't give a
- 'WYSIWYG' interface in messages. And also sorry that the above weren't very
- descriptive!
- _Dan
- ...........................................................................
-
- Fm: Everett Kaser (Sherlock) 70673,1547 # 313151
- To: Everett Kaser (Sherlock) 70673,1547 Date: 13-Mar-93 15:07:10
-
- OK, here's the internet ftp sites for soundboard related stuff that I had at
- work and their directories:
-
- ftp.brad.ac.uk misc/mod
- saffron.inset.com pub/unix/sound_drivers (access limited to 3:30pm-5:30am)
- ftp.ulowell.edu msdos/Sound/AdlibSB
- wuarchive.wustl.edu mirrors3/garbo.uwasa.fi/sb
- snake.mcs.kent.edu pub/SB-Adlib
- ccosun.caltech.edu pub/heathh/sb
-
- Good luck! I hope you find what you want.
-
- Everett
- ...........................................................................
-
- Fm: Everett Kaser (Sherlock) 70673,1547 # 313152
- To: Vu Truong (Siliconis) 70242,3015 (X) Date: 13-Mar-93 15:07:30
-
- Ok, I was unable to track down the file itself (that documents the .SBI file
- format) in my CAREFULLY arranged and METICULOUSLY indexed disk library <G>,
- so I typed in from a printed copy the section pertaining to the SBI format:
-
- -----------------------------------------------------------------------
-
- Sound Blaster Instruments File (SBI) Format:
- ----------------------------------------------
-
- The SBFM driver programs the registers of the FM chips to synthesize the
- different instrument sound. Such register information is stored in the SBI
- file with one instrument per file.
-
- The Sound Blaster IEDIT program allows users to define new instruments and
- store them in the SBI format.
-
- The format of the SBI file is as follows:
-
- Offset (hex): Description: -------------
- ------------------------------------------
- 00 - 03 File ID (ASCII string "SBI", ends with 1A hex)
- 04 - 23 Instrument Name (NULL terminated ASCII string).
- 24 Modulator Sound Characteristic
- 25 Carrier Sound Characteristic
- Bit 7 : Pitch Vibrato (AM)
- Bit 6 : Amplitude Vibrato (VIB)
- Bit 5 : Sustaining Sound (EG-TYP)
- Bit 4 : Envelope Scaling (KSR)
- Bit 3-0 : Frequency Multiplier (MULTIPLE)
- 26 Modulator Scaling/Output Level
- 27 Carrier Scaling/Output Level
- Bit 7-6 : Level Scaling (KSL)
- Bit 5-0 : Output Level (TL)
- 28 Modulator Attack/Decay
- 29 Carrier Attack/Decay
- Bit 7-4 : Attack Rate (AR)
- Bit 3-0 : Decay Rate (DR)
- 2A Modulator Sustain Level/Release Rate
- 2B Carrier Sustain Level/Release Rate
- Bit 7-4 : Sustain Level (SL)
- Bit 3-0 : Release Rate (RR)
- 2C Modulator Wave Select
- 2D Carrier Wave Select
- Bit 7-2 : All bits clear
- Bit 1-0 : Wave Select (WS)
- 2E Feedback/Connection
- Bit 7-4 : all bits clear
- Bit 3-1 : Modulator Feedback (FB)
- Bit 0 : Connection
- 2F - 33 Reserved for future use
-
-
- ------------------------- that's all folks! ------------------------------
-
- Everett
-
- _______________________ Subj: VOC Compression Method _______________________
-
- Fm: Bryant Bunderson 71742,1076 # 378740
- To: All Date: 18-Jun-93 15:43:46
-
- I am trying to write a program to compress my PCM sound files to the 4 bit
- ADPCM format used in the Sound Blaster VOC files so they don't take up so
- they don't take up so much space. I have only been partially successful.
-
- Does anyone out there have a specification or code fragment describing the
- compression algorithm used in 4 bit compressed VOC files?
-
- I have seen a lot of technical know how in this forum and thought I would ask
- here. Any help would be appreciated.
-
- Thanks, Bryant Bunderson
- ...........................................................................
-
- Fm: Bryant Bunderson 71742,1076 # 379544
- To: Andrew Amess 100141,1567 Date: 19-Jun-93 23:25:44
-
- Yes, the ADPCM method does lose information. It stands for Adaptive Delta
- Pulse Code Modulation. Basically instead of saving all the bits of a sample
- (PCM) it stores the difference or delta between two samples using fewer bits.
- Generally the fewer bits you use to represent the deltas the less the
- resulting wave looks like the original.
-
- I need my compressed sound files to be compatible with the Sound Blaster VOC
- format so I really should use thier method of ADPCM compression but thanks
- for the response.
-
- Bryant
- ...........................................................................
-
- Fm: Patrick Reilly 71333,2764 # 379632
- To: Bryant Bunderson 71742,1076 Date: 20-Jun-93 03:20:04
-
- Bryant,
- I though the Sound Blaster used a modified form of ADPCM (I know that's
- what *my* code used <g>) - a sentinel value is used to allow the following
- word to be full (in this case) 8-bit. For example, using 3-bit encoding, 0-6
- are delta values; a 7 indicates that the decoder should grab the following
- full 8-bits and use this as an absolute value instead of a delta. If the
- system is designed right, you can get nice size savings; I had some 8-bit
- sound files that ended up being (average) about the same size using 2-bit;
- for 3-bit, they averaged about 2/3, etc. In fact, it varied so widely from
- file to file that I ended up using a file header and allowing different bit
- sizes. The decode program (read in .WAV files) would go through and try 2, 3,
- 4, 5, and 6-bit encoding; whoever came out smallest won; if they were all
- bigger (never happened) used a special header signature to show that it was a
- raw 8-bit data file... Worked pretty well with PC-speaker sound library...
- -Pat-
- ...........................................................................
-
- Fm: Kirk Bateman 100112,71 # 379643
- To: Bryant Bunderson 71742,1076 Date: 20-Jun-93 05:57:22
-
- I wouldn't use the ADPCM routine SB style to compress your SB data because
- the loss in quality is too great, look in the CLMFORUM under the Data
- Compression Section there is some interresting work there.
- ---Kirk/UK
- ...........................................................................
-
- Fm: Bryant Bunderson 71742,1076 # 380900
- To: Patrick Reilly 71333,2764 (X) Date: 21-Jun-93 18:45:14
-
- I will look for a "sentinal bit" change in the data stream and see if I can
- determine if it is being used. I had come to the conclusion that they were
- doing something like that but didn't see a pattern. At least not a byte
- aligned pattern. Thanks for the help.
-
- Bryant
-
- P.S. Do your internal speaker routines work pretty well? I have pretty much
- crashed and burned every time I try to get intellagible playback through the
- internal speaker.
- ...........................................................................
-
- Fm: Patrick Reilly 71333,2764 # 381245
- To: Bryant Bunderson 71742,1076 (X) Date: 22-Jun-93 02:15:00
-
- Bryant,
- Sentinel value - I know that for *my* encoding/decoding, what I use for the
- sentinel value is the 'odd man out'. For example: with 4-bit encoding, this
- means that you have 1 sign bit and 3 'value' bits, for a range from +7 to -8.
- In this case, -8 is the sentinel value, and only +7..-7 are delta values (-8
- is 1000b).
- Yeah, my speaker lib worked fine; I only ran it in the foreground though
- (actually, it ran in the background, but I used a while-loop to do nothing
- until the buffer finished playing). I would seriously think that there would
- be some files here on CIS that have a speaker driver...
- -Pat-
- ...........................................................................
-
- Fm: John W. Ratcliff 70253,3237 # 381154
- To: Bryant Bunderson 71742,1076 (X) Date: 21-Jun-93 23:30:31
-
- An algorithm called ACOMP is in the public domain. It was published in the
- July 1992 issue of DDJ. It uses a special type of ADPCM that features a user
- selectable amount of loss, supports silence squelching, and provides
- extremely fast decompression speed.
-
- Go DDJFORUM to find the source.
-
- John.
- ...........................................................................
-